/***************************************
 * Document
 ***/
class Document
{
public:
	Document(){currentSheet = new Sheet();};
	~Document(){delete currentSheet;};
	bool New();
	bool Open(PTSTR FileName);
	bool Save();
	bool SaveAs(PTSTR FileName);
	bool Undo();
	bool Redo();
	bool CanUndo(){return !objHistory.NoUndo();}
	bool CanRedo(){return !objHistory.NoRedo();}
	bool AddCmdStep(Command* objCommand);
	
	bool	HasFileName(){return hasFileName;}
	bool	IsModified(){return isModified;}
	PTSTR	GetCurrentFileName() {return currentFileName;}
	PTSTR	GetCurrentFileTitle()	{return currentFileTitle;}
	Sheet*	GetSheet(){return currentSheet;}
	
	static int GetCount(){return iCount;}
protected:
	void UpdateFileName(PTSTR pstrNewFileName)
	{
		_tcscpy_s(currentFileName, _tcslen(pstrNewFileName) +1 , pstrNewFileName);
		::GetFileTitle(pstrNewFileName, currentFileTitle, MAX_PATH);
	}
	HistoryList objHistory;
	static TCHAR currentFileName[MAX_PATH];
	static TCHAR currentFileTitle[MAX_PATH];
	static int iCount;
	static bool hasFileName;
	bool isModified;
private:
	Sheet* currentSheet;
};